package bavaria.hightech.banking;

import java.util.ArrayList;
import java.util.List;

public class Buchungsliste {
	List<Buchung> buchungsliste;
	private int counter;
	
	public Buchungsliste() {
		buchungsliste = new ArrayList<Buchung>();
	}
	
	public void add(Buchung b){
		buchungsliste.add(b);
	}
	
	public void clear(){
		buchungsliste.clear();
	}
	
	public Buchung next(){
		if(counter >= buchungsliste.size()){
			return null;
		}
		Buchung b = buchungsliste.get(counter);
		counter++;
		return b;
	}
	
	public void resetIteration(){
		counter = 0;
	}
	
	public String toString(){
		String s = "\n";
		for (Buchung element : buchungsliste) {
			s += element.toString() +"\n";
		}
		return s;
	}

}
